package ws.com.controller;

import com.responseData.R;
import com.responseData.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import ws.com.activeMQ.product.Product;
import ws.com.mapper.BarrageMapper;
import ws.com.pojo.Barrage;
import ws.com.pojo.BarrageReq;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/barrage")
public class BarrageController {

    @Autowired
    private Product product;

    @Resource
    private BarrageMapper barrageMapper;


    /**
     * 获取视频弹幕
     * @param barrageReq 包含vid start end
     * @return
     */
    @PostMapping("/getVideoBarrage")
    public R getVideoBarrage(@RequestBody BarrageReq barrageReq){
        List<Barrage> barrages = new ArrayList<>();
        try{
            barrages = barrageMapper.getBarrageList(barrageReq);

        }catch (Exception e){
            e.printStackTrace();
        }
        return ResponseData.success(barrages);
    }
}
